package com.battle.service.controller.web;

import com.battle.pojo.param.tacticsType.*;
import com.battle.pojo.vo.tacticsType.*;
import com.battle.service.service.in.*;
import nirvana.core.domains.vo.PageResult;
import nirvana.core.domains.vo.ApiResult;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

import java.util.List;

/**
 * web/战术类型
 * 【描 述】：
 * 【环 境】：J2SE
 * 【详 细】：
 */
@RestController
@RequestMapping("/tacticsType/web")
public class TacticsTypeWebController {

    private final TacticsTypeService service;

    public TacticsTypeWebController(TacticsTypeService service) {
        this.service = service;
    }


    /**
     * 创建战术类型
     *
     * @param param
     * @return
     */
    @PostMapping("/createTacticsType")
    public ApiResult createTacticsType(@RequestBody @Valid CreateTacticsTypeParam param) {
        service.createTacticsType(param);
        return ApiResult.ok();
    }


    /**
     * 修改战术类型
     *
     * @param param
     */
    @PutMapping("/editTacticsType")
    public ApiResult editTacticsType(@RequestBody @Valid EditTacticsTypeParam param) {
        service.editTacticsType(param);
        return ApiResult.ok();
    }

    /**
     * 移除战术类型
     *
     * @param id
     */
    @DeleteMapping("/removeTacticsType")
    public ApiResult removeTacticsType(@RequestParam("id") Long id) {
        service.removeTacticsType(id);
        return ApiResult.ok();
    }

    /**
     * 启动/禁用战术类型
     *
     * @param id
     */
    @GetMapping("/enabledTacticsType")
    public ApiResult enabledTacticsType(@RequestParam("id") Long id) {
        service.enabledTacticsType(id);
        return ApiResult.ok();
    }

    /**
     * 获取战术类型详情
     *
     * @param id
     * @return
     */
    @GetMapping("/getTacticsType")
    public ApiResult<GetTacticsTypeVo> getTacticsType(@RequestParam("id") Long id) {
        GetTacticsTypeVo vo = service.getTacticsType(id);
        return ApiResult.ok(vo);
    }

    /**
     * 获取战术类型列表
     *
     * @param param
     * @return
     */
    @PostMapping("/getTacticsTypeList")
    public ApiResult<PageResult<GetTacticsTypeListVo>> getTacticsTypeList(@RequestBody GetTacticsTypeListParam param) {
        PageResult<GetTacticsTypeListVo> result = service.getTacticsTypeList(param);
        return ApiResult.ok(result);
    }


    /**
     * 获取战术类型下拉列表
     *
     * @return
     */
    @PostMapping("/getTacticsTypeDownList")
    public ApiResult<List<GetTacticsTypeDownListVo>> getTacticsTypeDownList(@RequestBody(required = false) @Valid GetTacticsTypeDownListParam param) {
        List<GetTacticsTypeDownListVo> list = service.getTacticsTypeDownList(param);
        return ApiResult.ok(list);
    }


}

